package com.gzhu.knowledgeAdmin.service.impl;


import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gzhu.knowledgeAdmin.dao.RolePermissionMapper;
import com.gzhu.knowledgeAdmin.entity.RolePermission;
import com.gzhu.knowledgeAdmin.service.RolePermissionService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 角色权限 服务实现类
 * </p>
 *
 * @author testjava
 * @since 2020-01-12
 */
@Service
public class RolePermissionServiceImpl extends ServiceImpl<RolePermissionMapper, RolePermission> implements RolePermissionService {

    @Override
    public void removeByRoleId(String id) {

        baseMapper.delete(new UpdateWrapper<RolePermission>().eq("role_id",id));
    }

    @Override
    public void removeBatchByRoleIds(List<String> idList) {
        baseMapper.delete(new UpdateWrapper<RolePermission>().in("role_id",idList));
    }

    @Override
    public void removeBatchByPermissionIds(List<String> idList) {
        baseMapper.delete(new UpdateWrapper<RolePermission>().in("permission_id",idList));
    }
}
